import { CHANNEL_SET_LIST, CHANNEL_SET_CURRENT } from './actionType';
const initialState = {
  // 频道数据
  list: [],
  // 选中的频道
  current: 0,
};

export default function channelReducer(state = initialState, { type, payload }) {
  switch (type) {
    case CHANNEL_SET_LIST:
      return {
        ...state,
        list: [...payload],
      };

    case CHANNEL_SET_CURRENT:
      return {
        ...state,
        current: payload,
      };

    default:
      return state;
  }
}
